<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title><%= title %> - Microblog</title>
    <link rel='stylesheet' href='/stylesheets/bootstrap.css' />
    <style type="text/css">
        body {
            padding-top: 60px;
            padding-bottom: 40px;
        }
    </style>
    <link href="stylesheets/bootstrap.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">Microblog</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li class="active"><a href="/">首页</a></li>
                <% if (!user) { %>
                <li><a href="/login">登入</a></li>
                <li><a href="/reg">注册</a></li>
                <% } else { %>
                <li><a href="/logout">登出</a></li>
                <% } %>

            </ul>
        </div>
    </div>
</nav>
<div id="container" class="container">
    <div class="hero-unit">

        <% if (!user) { %>
        <div class="jumbotron">
            <h1>欢迎来到 Microblog</h1>
            <p>Microblog 是一个基于 Node.js 的微博系统。</p>
            <p>
                <a class="btn btn-primary btn-large" href="/login">登录</a>
                <a class="btn btn-large" href="/reg">立即注册</a>
            </p>
        </div>
            <% } else { %>
                <form method="post" class="well form-inline center" style="text-align: center;">
                    <input type="text" class="span8" name="post" id="publish">
                    <button type="button" class="btn btn-success" onclick="release()"><i class="icon-comment icon-white"></i> 发言</button>
                </form>
                <% }%>



    </div>

    <% posts.forEach(function(post, index) {
    if (index % 3 == 0) { %>
    <div class="row">
        <%} %>
        <div class="col-md-4">
            <h2><a href="/u/<%= post.name %>"><%= post.name %></a> 说</h2>
            <p><small><%= post.time %></small></p>
            <p><%= post.content %></p>
        </div>
        <% if (index % 3 == 2) { %>
    </div><!-- end row -->
    <% } %>
    <%}) %>
    <% if (posts.length % 3 != 0) { %>
        </div><!-- end row -->
    <%} %>
    <div class="row">

        <image src="images/index.gif" width="100" height="100" style="margin-left: 20px;float: left" />
        <div class="span4" style=" margin-left: 20px;float: left" >
            <h2>yzw</h2>
            <p>累成狗</p>

        </div>
    </div>



    <footer>
        <p><a href="#" target="_blank">yzw</a> 2016</p>
    </footer>
</div>
</body>
<script src="/javascripts/jquery.js"></script>
<script src="/javascripts/bootstrap.js"></script>
<script src="/javascripts/index.js"></script>
</html>